package com.sky.mapper;

import com.sky.entity.User;
import com.sky.vo.OrderStatisticsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@SuppressWarnings("all")
/**
 *@ClassName UserMapper
 *@Description TODO
 *@Author @O_o  GW__
 *@Date 2025/5/28 17:29
 *@Version 1.0
 */
@Mapper
public interface UserMapper {
    /**
     * 根据openid查询用户
     *
     * @param openid
     */
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    /**
     * 插入用户数据
     *
     * @param user
     */
    void insert(User user);

    /**
     * 根据id查询用户
     *
     * @param userId
     * @return
     */
    @Select("select * from user where id = #{userId}")
    User getById(Long userId);

    /**
     * 各个状态的订单数量统计
     *
     * @param user
     */
    OrderStatisticsVO countStatus();
    /**
     * 根据动态条件统计用户数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
